﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Frame.Lib.Core.Tree.Dir
{
    public class DirInfo:TreeInfo
    {

        public override string GetTableName()
        {
            return "";
        }
        public override string GetInsertSql()
        {
            return "insert into [-TableName-] ( ID, Name, UpperID, Path, Depth, Orders, CreatorID, CreatorName, InputTime, Remark) values ( @ID, @Name, @UpperID, @Path, @Depth, @Orders, @CreatorID, @CreatorName, @InputTime, @Remark)";
        }
        public override string GetUpdateSql()
        {
            return "update [-TableName-] set  ID = @ID, Name = @Name, UpperID = @UpperID, Path = @Path, Depth = @Depth, Orders = @Orders, CreatorID = @CreatorID, CreatorName = @CreatorName, InputTime = @InputTime, Remark = @Remark where ID = @ID";
        }

        public int CreatorID
        {
            get;
            set;
        }
        public string CreatorName
        {
            get;
            set;
        }
        public DateTime InputTime
        {
            get;
            set;
        }
        public string Remark
        {
            get;
            set;
        }

        public override void SetValue(string key, object value)
        {
            key = key.ToLower();
            switch (key)
            {
                case "id":
                    this.ID = (Int32)value;
                    break;
                case "name":
                    this.Name = (String)value;
                    break;
                case "upperid":
                    this.UpperID = (Int32)value;
                    break;
                case "path":
                    this.Path = (String)value;
                    break;
                case "depth":
                    this.Depth = (Int32)value;
                    break;
                case "orders":
                    this.Orders = (Int32)value;
                    break;
               
                case "creatorid":
                    this.CreatorID = (Int32)value;
                    break;
                case "creatorname":
                    this.CreatorName = (String)value;
                    break;
                case "inputtime":
                    this.InputTime = (DateTime)value;
                    break;
                case "remark":
                    this.Remark = (String)value;
                    break;
             
            }
        }
        public override object GetValue(string key)
        {
            key = key.ToLower();
            switch (key)
            {
                case "id":
                    return this.ID;
                case "name":
                    return this.Name;
                case "upperid":
                    return this.UpperID;
                case "path":
                    return this.Path;
                case "depth":
                    return this.Depth;
                case "orders":
                    return this.Orders;
              
                case "creatorid":
                    return this.CreatorID;
                case "creatorname":
                    return this.CreatorName;
                case "inputtime":
                    return this.InputTime;
                case "remark":
                    return this.Remark;
              
                default:
                    return null;
            }
        }


    }
}
